package gui;

import fs.Data;

/**
 *
 * @author lucifer
 */
public class LAF {

  public static final String UNIX = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
  public static final String MAC  = "javax.swing.plaf.nimbus.NimbusLookAndFeel";
  public static final String JAVA = "javax.swing.plaf.metal.MetalLookAndFeel";
  public static final String GTK = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
  public static final String WIN = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";

  public static final String DEFAULT = UNIX;

  private App app;
  private String theme;

  public LAF(App app) {
    this.app = app;
    init();
  }

  private void init() {
    boolean toolbar;
    try {
      //toolbar = (boolean) Data.readFrom(Data.TOOLBAR_FILE);
      theme = (String) Data.ReadFrom(Data.LOOK_AND_FEEL_FILE);
    }
    catch (Exception e) {
      toolbar = true;
      theme = DEFAULT;
    }
    //app.getShowToolbarJCheckBoxMenuItem().setSelected(toolbar);
    //setToolbar(app.getShowToolbarJCheckBoxMenuItem().isSelected());
  }

  public void setToolbar(boolean toolbar) {
    try {
      //Data.writeObjectOn(toolbar, Data.TOOLBAR_FILE);
      //frame.getApplicationJToolbar().setVisible(toolbar);
    }
    catch (Exception e) {
    }
  }

  public void SetTheme(String lookAndFeel) {
    try {
      Data.WriteObjectTo(lookAndFeel, Data.LOOK_AND_FEEL_FILE);
    } catch (Exception e) {
      System.out.printf("?look and feel issue\n");
    }
  }

  public String LookAndFeel() {
    return theme;
  }

}
